<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="lib/echarts.min.js"></script>
</head>
<body>
    <div style="width: 600px; height: 400px;"></div>

    <script>
        // 1.Echarts最基本的代码结构
        // 2.x轴数据:['张三','李四','王五','闰土','小明','茅台','二妞','大强']
        // 3.y轴数据：[88,92,63,77,94,80,72,86]
        // 4.将type的值设置为bar
        var myCharts = echarts.init(document.querySelector('div'))
        var xDataArr = ['张三','李四','王五','闰土','小明','茅台','二妞','大强']
        var yDataArr = [88,92,63,77,94,80,72,86]
        var option = {
            title:{
                text:'成绩展示',
                textStyle:{
                    color:'red'
                },
                borderWidth:5,
                borderColor:'blue',
                borderRadius:5,
                left:50,
                top:10
            },
            tooltip:{
                // trigger:'item'
                trigger:'axis',
                // trigger:'mouseover',
                triggerOn:'click',
                // formatter:'{b} 的成绩是 {c}'
                formatter:function(arg){
                    console.log(arg);
                    return arg[0].name +'的分数是' + arg[0].data
                }
            },
            xAxis:{
                type:'category',
                data:xDataArr
            },
            yAxis:{
                type:'value'
            },

            series:[
                {
                    name:'语文',
                    type:'bar',
                    data:yDataArr
                }
            ]
        }
        myCharts.setOption(option)
    </script>
</body>
</html>